package com.budweiser.user.dao;

import com.budweiser.model.user.Permission;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

@Mapper
public interface PermissionDao {
	@Options(useGeneratedKeys = true, keyProperty = "id")
	@Insert("insert into sys_permission(permission, name, createTime, updateTime) values(#{permission}, #{name}, #{createTime}, #{createTime})")
	void insert(Permission permission);

	@Update("update sys_permission t set t.name = #{name}, t.permission = #{permission}, t.updateTime = #{updateTime} where t.id = #{id}")
	void update(Permission permission);

	void updateDelStatus(List<Long> ids);

	int count(Map<String, Object> params);

	List<Permission> findData(Map<String, Object> params);

	/***
	 * 查询所有权限
	 * 
	 * @return
	 */
	@Select("select * from sys_permission where deleteStatus = 0")
	List<Permission> getPermissionList(Long roleid);

}
